#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QWidget>
#include "musiclist.h"

#include <QPixmap>

namespace Ui {
class CommonPage;
}

enum PageType
{
    LIKE_Page,
    LOCAL_Page,
    HISTOARY_Page
};

class CommonPage : public QWidget
{
    Q_OBJECT

public:
    void setMuisListType(PageType type);
    explicit CommonPage(QWidget *parent = nullptr);
    void addMusicToMysicPage(const MusicList& musicList);
    ~CommonPage();

    void setCommonPageUi(const QString& text,const QString& imagePath);
    void reFresh(MusicList& musicList);

    void addMusicToPlayerList(MusicList& musicList,QMediaPlaylist* playList);

    void setMusicImage(QPixmap pixmap);

    QString getMusicByIndex(int index);
signals:
    void updateLikeMusic(bool isLike,const QString& musicId);
    void playAll(PageType);
    void playMusicByIndex(CommonPage*,int);

private slots:
    void on_playAllBtn_clicked();

private:
    Ui::CommonPage *ui;
    PageType pageType;
    QVector<QString> musicOfPage;//保存对应界面的歌曲ID




};

#endif // COMMONPAGE_H
